<?php

/*
|--------------------------------------------------------------------------
| Web Routes
|--------------------------------------------------------------------------
|
| Here is where you can register web routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| contains the "web" middleware group. Now create something great!
|
*/

use App\Http\Controllers\Admin\IndexController;
use GuzzleHttp\Middleware;


Route::group(['prefix'=>'admin','namespace'=>'Admin','as'=>'admin.'],function(){
    // 后台登录
    Route::get('login','LoginController@index')->name('login');
    Route::post('login','LoginController@login')->name('login');

    Route::group(['middleware'=>['checkadminlogin']],function(){
          // 后台首页
        Route::get('index','IndexController@index')->name('index');
        Route::get('welcome','IndexController@welcome')->name('welcome');
        //用户退出操作
        Route::get('logout','IndexController@logout')->name('logout');

        //用户列表
       Route::get('user/index','AdminController@index')->name('admin.index');
        //添加新用户
        Route::get('user/create','AdminController@create')->name('admin.create');
        Route::post('user/store','AdminController@store')->name('admin.store');

        // 用户删除操作
        Route::post('user/del/{id}','AdminController@destory')->name('admin.destory');
        Route::post('user/delall','AdminController@destoryall')->name('admin.destoryall');
        //用户编辑
        Route::get('user/edit/{id}','AdminController@edit')->name('admin.edit');
        Route::post('user/edit/{id}','AdminController@edit')->name('admin.edit');

    
    });
  
    






});
